/***************************************************************************
 创建者: 华磊
 开始时间: 2019.2.25
 copyright: (C) 华友高科
 修改说明: (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 example (1) hualei 2020.5.8 类的具体实现代码编写

 ***************************************************************************
 *  @file x.h
 *  功能: 检测二维码位置功能桥接器
 *
 *                                                                         *
 ***************************************************************************/
#ifndef QRCODESENSORADAPTER_H
#define QRCODESENSORADAPTER_H
#include <QObject>
#include <QTimer>
#include "../HmiGsoapQt/gSoapFoundation/soapStub.h"
#include "GeneralDefine.h"

class QrcodeDetect;
//struct QrcodeDebugInfo
//{
//    VehiclePosition positionFeedback;
//    int sensorId;
//    bool isDeviceOpened;
//    bool isImageAcquired;
//    int featureSqureCount;
//    double minConsumed;
//    double currentConsumed;
//    double maxConsumed;
//};



class QrcodeSensorAdapter : public QObject
{
    Q_OBJECT
public:
    explicit QrcodeSensorAdapter(QString configFileIn,QObject *parent = nullptr);
public:
    bool isInitialOk();
    bool isUseThisModule();
    int getVehiclePosition(PositionInfo &positionOut);
    int setCameraId(int cameraIdIn);
    int showDebugWindow(int id);
    int getQrcodeSensorDebugInfo(QrcodeDebugInfo &debugInfoOut);
    int setDetectParameter(QrcodeDetectParameter parameterIn);

signals:

public slots:
    void timeOut_slot();

private:
    int initialConfigFile(QString configFileName);
    int updatePosition(int cameraIdIn,VehiclePosition &posOut,bool &isDeviceOpenedOut,
                       bool &isImageAcquiredOut,int &featureSqureCountOut);

private:
    bool isUseSensor;
    bool isInitialOkStatus;
    int sensorId;
    double pose_x;
    double pose_y;
    double pose_z;
    double pose_yaw;
    double pose_pitch;
    double pose_roll;
    double x_ratio;
    double y_ratio;
    double r_ratio;
    QrcodeDetectParameter detectPara;

    QTimer* timer;

    QrcodeDetect *qrcodeDetect;

    VehiclePosition positionFeedback;
    QrcodeDebugInfo debugInfo;
};

#endif // QRCODESENSORADAPTER_H
